<div id="main" class="span-24 last main">
    <div class="span-13">
        <div class="section_ads">
        <h2><?php echo $this->translate('Last items published');?></h2>
         <!-- Start WOWSlider.com BODY section -->
            <div id="wowslider-container1">
                <div class="ws_images">
                    <span><img src="/WOW Slider/data1/images/slider01.png" alt="Da. Ayuda. Busca. Encuentra" title="Da. Ayuda. Busca. Encuentra" id="wows0"/></span>
                    <span><img src="/WOW Slider/data1/images/slider02.png" alt="Próximamente..." title="Próximamente..." id="wows1"/></span> 
                </div>
                <div class="ws_bullets"><div>
                    <a href="#wows0" title="Da. Ayuda. Busca. Encuentra">1</a>
                    <a href="#wows1" title="Próximamente...">2</a>
                </div></div>
                <a style="display:none" href="http://wowslider.com">jQuery Slider Date by WOWSlider.com v1.9</a>
                <div class="ws_shadow"></div>   
            </div>
            <script type="text/javascript" src="/WOW Slider/engine1/script.js"></script>
    <!-- End WOWSlider.com BODY section -->
   
            <?php if ($this->allGives): ?>
                   <?php
                   foreach ($this->allGives as $key => $val): ?>
                            <div class="ad_excerpt_home">
                            <?php
                               if ($val['photo'] !== null){
                                          echo '<div class="ad_list_image">
                                          <a href="/'.$this->lang.'/ad/show/id/'.$this->escape($val['id']).'/'.$this->escape($val['title']).' ">
                                          <img alt="'.$this->escape($val['title']).'" src="/images/uploads/ads/100/'.
                                          $this->escape($val['photo']).'" /></a></div>';
                               } else {
                                           echo '<div class="ad_list_image">';                 
                                    if ($this->lang == 'es') {
                                            echo '<a href="/'.$this->lang.'/ad/show/id/'.$this->escape($val['id']).'/'.$this->escape($val['title']).' ">
                                                     <img alt="'.$this->escape($val['title']).'" src="/images/sin_imagen.jpg" /></a></div>';
                                    } else {
                                          echo '<a href="/'.$this->lang.'/ad/show/id/'.$this->escape($val['id']).'/'.$this->escape($val['title']).' ">
                                                     <img alt="'.$this->escape($val['title']).'" src="/images/no_image.jpg" /></a></div>';
                                    }
                               }
                              
                               // if you are the ad owner or admin, then show edit link
                               $auth = Zend_Auth::getInstance ();
                               if ($auth->hasIdentity()):
                                    if ( ($val['user_owner'] == $auth->getIdentity()->id)  || ($this->userRole == 1) ): ?>
                                    <div>
                                        <a class="ads_section" href="/<?=$this->lang ?>/ad/edit/id/<?=$val['id'] ?>">
                                            <?=$this->translate('Edit this ad') ?></a>
                                    </div>
                                 <?php endif; endif;?>
                                 
                                 <?php if ($val['type'] == 1):?>
                                       <span class="ad_status <?=$val['status'] ?>">
                                           <?=$this->translate($val['status']) ?></span>
                                    <?php endif;?>
                                   
                                 <div class="ad_excerpt_title"><a class="ad_title_link" href="/<?=$this->lang ?>/ad/show/id/<?=$this->escape($val['id']).'/'.$this->escape($val['title']) ?>">
                               <?=$this->escape($val['title']) ?></a></div>
                               
                               <?php if ($val['type'] == 1) {$adtype = "give";
                                    $adtype_translate = "Give";
                               } else {
                                       $adtype = "want";
                                       $adtype_translate = "Want";
                               }?>
                                               
                                                  
                              <div class="ad_excerpt_woeid"><a class="ads_section" href="/<?=$this->lang.'/woeid/'.$val['woeid_code'].'/'.$adtype ?>">
                                 <?=$this->woeidName($val['woeid_code'], $this->lang).' > '.$this->translate($adtype_translate) ?> </a></div>
        
                              <span class="ad_date"><?=$this->translate('Posted on '). $this->escape(date( $this->translate('l dS \o\f F Y H:i:s'), strtotime($val['date_created']))) ?>
                              <?=$this->translate('by user ') ?>
                              <a class="ads_section" href="/<?=$this->lang ?>/ad/listuser/id/<?=$val['user_owner'] ?>"><?=$this->escape($val['username']) ?></a>
                              </span>
                                                    
                                                    <div class="ad_body">
                                                        
                                                         <? if ($val['type'] == 1) { ?>
                                                   <img class="ad_type" alt="<?=$this->translate ('Give')?>" src="/images/icons/ico_doy.png"/>
                                                  <? } else { ?>
                                                     <img class="ad_type" alt="<?=$this->translate ('Want')?>" src="/images/icons/ico_quiero.png"/>
                                                  <? } ?>
                                                     
                              <p><?php echo $this->escapeEmail( $this->escape($val['body']) ) ?></p></div>
        
                                                    <div class="ad_meta_info">
                                    <?php if ($val['status'] != 'delivered'): ?>
                                        <div class="send_message">
                                           <a rel="nofollow" class="ads_section" href="/<?=$this->lang ?>/message/create/id_user_to/<?=$val['user_owner'].'/subject/'.$this->escape($val['title'])
                                       ?>">+ <?=$this->translate('Send message to the owner') ?></a>
                                           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><a class="ads_section" href="/<?=$this->lang ?>/ad/show/id/<?=$this->escape($val['id']).'/'.$this->escape($val['title'])
                                   ?>">+ <?=$this->translate('Write a new comment') ?></a></b></div>
                                <?php endif;?>
        
                                       <?php if ($val['readings_count']): ?>
                                       <div class="readings_count"><?=$val['readings_count'] . '&nbsp;&nbsp;' .$this->translate('readings') ?></div>
                            <?php endif;?>
        
                            <?php if ($val['comments_count']): ?>
                             <div class="comments_count"><?=', '.$this->escape( $val['comments_count'] == null  ? 0 : $val['comments_count'] ).' '.$this->translate('comments') ?></div>
                             <?php endif;?>
                             
                           </div>
                    </div>

                <?php endforeach; ?>
                
                <div class="more_ads_icon">
                            <a class="more_ads" href="/<?php echo $this->lang ?>/ad/listall/ad_type/give/page/2">
                            <span><?=$this->translate('View more ads'); ?></span><img alt="<?=$this->translate('View more ads') ?>" src="/images/icons/ico_more_ads.png" class="valign2" /></a>
                        </div>
         <?php endif;?>
        </div>
    </div>

        <div class="span-6 section_generous">
            <div class="new_ad_icon">
                <a class="new_ad" href="/<?=$this->lang ?>/ad/create">
                <img alt="<?=$this->translate('Begin giving...') ?>" src="/images/icons/ico_new_ad.png" class="valign" /><span><?=$this->translate('Begin giving...'); ?></span></a>
            </div>
            
            <div class="new_ad2_icon">
                <a class="new_ad2" href="/<?=$this->lang ?>/ad/create">
                <img alt="<?=$this->translate('Do you need anything?') ?>" src="/images/icons/ico_new_ad2.png" class="valign" /><span><?=$this->translate('Do you need anything?'); ?></span></a>
            </div>
            
            <div class="change_location_icon">
                <a class="change_location" href="/<?=$this->lang ?>/location/change">
            <img alt="<?=$this->translate('Change location' ) ?>" src="/images/icons/ico_change_location.png" class="valign" /><span><?=$this->translate('Change location'); ?></span></a>
            </div>
            
            <div class="section_locations">
        <h2><?php echo $this->translate('Most generous cities');?></h2>
        <br />
        <?php
        //Zend_Debug::dump($this->rankingWoeid);
        if ($this->rankingWoeid): ?>
        <ul>
             <?php   foreach ($this->rankingWoeid as $key => $val): ?>
            <li>
                <a class="section_locations_link" href="/<?=$this->lang.'/woeid/'.$val['woeid_code'].'/give' ?>">
                         <?=$this->woeidName($val['woeid_code'], $this->lang) . ' (' .$val['ads_count']. ')'?> </a>
            </li>      
                    <?php endforeach; ?>
            </ul>
       <?php endif;?>

        </div>
        <div class="section_users">
        <h2><?php echo $this->translate('Most generous users');?></h2>
        <br />
        <?php if ($this->rankingUsers): ?>
        <ul>
                   <?php   $i = 0; foreach ($this->rankingUsers as $key => $val): ?>
            <li>
                <a class="section_users_link" href="/<?=$this->lang.'/ad/listuser/id/'.$val['user_owner'] ?>">
                         <?=$val['user_name'] . ' (' .$val['ads_count']. ')'?> </a>
            </li>
                    <?php endforeach; ?>

            </ul>
       <?php endif;?>
    </div>
        <br />
    <iframe src="http://files.bannersnack.com/iframe/embed.html?hash=0e88fe5213289bf26da30370b2824988&bgcolor=%233D3D3D&alt=screenshot&t=1310588758" width="230" height="230" frameborder="0"></iframe>
    <br />
    <br />
    <div id="fb-root"></div>
    <fb:like-box href="http://www.facebook.com/Segundamanita" width="230" show_faces="true" border_color="" stream="false" header="true"></fb:like-box>
      <br />
    <script src="http://widgets.twimg.com/j/2/widget.js"></script>
    <br />
        <script>
            new TWTR.Widget({
              version: 2,
              type: 'profile',
              rpp: 4,
              interval: 6000,
              width: 230,
              height: 200,
              theme: {
                shell: {
                  background: '#4d6c86',
                  color: '#ffffff'
                },
                tweets: {
                  background: '#ffffff',
                  color: '#000000',
                  links: '#4d6c86'
                }
              },
              features: {
                scrollbar: true,
                loop: true,
                live: true,
                hashtags: false,
                timestamp: true,
                avatars: true,
                behavior: 'default'
              }
            }).render().setUser('Segundamanita_').start();
        </script>
    
    </div>

    <div class="span-5 last"><div class="advertising">
            <!-- BEGIN VIVIRGRATIS -->
                <a href="http://www.vivirgratis.com" target="_blank">
                    <img src="/images/banner/vivir-gratis.jpg" border="0" alt="Vivir Gratis" width="125" height="104" /></a>
            <!-- END  -->
        </div>
        <div class="clearer"></div>
        <div class="advertising">
            <!-- BEGIN PARTNER PROGRAM - DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK -->
                <a href="http://web.epartner.es/click.asp?ref=570686&site=5327&type=b35&bnb=35" target="_blank">
                    <img src="http://program.epartner.es/view.asp?ref=570686&site=5327&b=35" border="0" alt="Logotipo Ecologico 1&1" width="125" height="104" /></a>
            <!-- END PARTNER PROGRAM -->
        </div>
        <div class="clearer"></div>
        <div class="advertising">
            <!-- BEGIN PARTNER PROGRAM - DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK -->
                <script language="javascript" type="text/javascript" src="http://program.epartner.es/view.asp?ref=570686&site=8346&type=html&hnb=5&js=1"></script>
                <noscript><a href="http://web.epartner.es/click.asp?ref=570686&site=8346&type=b1&bnb=1" target="_blank">
                    <img src="http://program.epartner.es/view.asp?ref=570686&site=8346&b=1" border="0"/></a><br /></noscript>
            <!-- END PARTNER PROGRAM -->
        </div>
        <div class="clearer"></div>
        
    </div>
</div> <!-- /main -->

